package com.banciyuan.bcywebview.base.factory;

import com.banciyuan.bcywebview.utils.string.StringUtil;

import de.greenrobot.daoexample.model.Message;

/**
 * Created by hfxt2008 on 14-8-22.
 * 生成Message类的工厂类，用于解析json，然后生成一个list<MessscaleOfLayoutage>
 */
public class MessageFactory {

    public final static int MESSAGE_TYPE_OTHER = -101;
    public final static int SEND_DAILY_GIFT = 98;
    public final static int SEND_GIFT = 99;
    public final static int MESSAGE_TYPE_DAILY = 101;
    public final static int MESSAGE_TYPE_GROUP = 102;
    public final static int MESSAGE_TYPE_COS = 103;
    public final static int MESSAGE_TYPE_ILL = 104;
    public static final int MESSAGE_TYPE_WRITER = 100;
    public final static int MESSAGE_TYPE_ASK = 123;
    public final static int MESSAGE_TYPE_ASKED = 124;
    public final static int MESSAGE_TYPE_ASK_SELF = 125;
    public final static int MESSAGE_TYPE_FOLLOW = 105;
    public final static int MESSAGE_TYPE_DING = 106;
    public final static int MESSAGE_TYPE_TUIJIAN = 107;
    public final static int MESSAGE_TYPE_DAILY_DING = 108;
    public final static int MESSAGE_TYPE_DAILY_TUIJIAN = 109;
    public final static int MESSAGE_TYPE_GROUP_DING = 110;
    public final static int MESSAGE_TYPE_GROUP_TUIJIAN = 111;
    public final static int MESSAGE_TYPE_ASK_DING = 118;
    public final static int MESSAGE_TYPE_ASK_TUIJIAN = 119;
    public final static int MESSAGE_TYPE_REPLY = 112;
    public final static int MESSAGE_TYPE_COMMENT = 113;
    public final static int MESSAGE_TYPE_DAILY_REPLY = 114;
    public final static int MESSAGE_TYPE_DAILY_COMMENT = 115;
    public final static int MESSAGE_TYPE_GROUP_REPLY = 116;
    public final static int MESSAGE_TYPE_GROUP_COMMENT = 117;
    public final static int MESSAGE_TYPE_ASK_ASK = 120;
    public final static int MESSAGE_TYPE_ASK_ANSWER = 121;
    public final static int MESSAGE_TYPE_ASK_NONAMEASK = 122;
    public final static int MESSAGE_TYPE_REPLY_DING = 126;
    public final static int MESSAGE_TYPE_NOVEL_SUBSCRIBE = 130;
    public final static int MESSAGE_TYPE_NOVEL_UPDATE = 131;
    public final static int MESSATE_TYPE_GROUPTEAM_TUIJIAN = 132;
    public final static int MESSATE_TYPE_GROUPTEAM = 133;

    public final static int MESSAGE_TYPE_COSER_CONTENT = 134;
    public final static int MESSAGE_TYPE_DRAWER_CONTENT = 135;
    public final static int MESSAGE_TYPE_WRITER_CONTENT = 136;
    public final static int MESSAGE_TYPE_DAILY_CONTENT = 137;
    public final static int MESSAGE_TYPE_GROUPPOST_CONTENT = 138;
    public final static int MESSAGE_TYPE_GROUPINTRO_CONTENT = 139;
    public final static int MESSAGE_TYPE_TAGGROUPADD_CONTENT = 140;

    public final static int COSER_POST_LOCK = 141;
    public final static int COSER_POST_UNLOCK = 142;
    public final static int DRAWER_POST_LOCK = 143;
    public final static int DRAWER_POST_UNLOCK = 144;
    public final static int WRITER_POST_LOCK = 145;
    public final static int WRITER_POST_UNLOCK = 146;
    public final static int DAILY_LOCK = 147;
    public final static int DAILY_UNLOCK = 148;
    public final static int SPECIAL = 149;
    public final static int DISCOVER = 150;

    public final static int TOP_LIST_COSER = 151;
    public final static int TOP_LIST_DRAWER = 152;
    public final static int TOP_LIST_WRITE = 153;
    public final static int GROUP_INVITE = 89;
    public final static int CIRCLE_TOP_LIST = 160;

    public final static int ZHIPING_SOLD = 161;
    public final static int ZHIPING_LOCK = 162;
    public final static int ZHIPING_UNLOCK = 163;
    public final static int ZHIPING_TUIJIAN = 97;
    public final static int ZHIPING_DING = 96;

    public final static int COMMENT_REPLAY_ME = 80;
    public final static int COMMENT_REPLAY_AT_ME = 81;

    public final static int COSER_COMMENT_DING = 82;
    public final static int DRAWER_COMMENT_DING = 83;
    public final static int WRITER_COMMENT_DING = 84;
    public final static int DAILY_COMMENT_DING = 85;
    public final static int GROUP_POST_COMMENT_DING = 86;

    public static int inWhichType(String type) {
        if (StringUtil.notNullEqual(type, "coser_atme")) return MESSAGE_TYPE_COS;
        else if (StringUtil.notNullEqual(type, "coser_replyme")) return MESSAGE_TYPE_COS;
        else if (StringUtil.notNullEqual(type, "drawer_atme")) return MESSAGE_TYPE_ILL;
        else if (StringUtil.notNullEqual(type, "drawer_replyme")) return MESSAGE_TYPE_ILL;
        else if (StringUtil.notNullEqual(type, "group_atme")) return MESSAGE_TYPE_GROUP;
        else if (StringUtil.notNullEqual(type, "group_topic_reply")) return MESSAGE_TYPE_GROUP;
        else if (StringUtil.notNullEqual(type, "daily_replyme")) return MESSAGE_TYPE_DAILY;
        else if (StringUtil.notNullEqual(type, "daily_atme")) return MESSAGE_TYPE_DAILY;
        else if (StringUtil.notNullEqual(type, "weibo_follow")) return MESSAGE_TYPE_FOLLOW;
        else if (StringUtil.notNullEqual(type, "drawer_ding")) return MESSAGE_TYPE_ILL;
        else if (StringUtil.notNullEqual(type, "coser_ding")) return MESSAGE_TYPE_COS;
        else if (StringUtil.notNullEqual(type, "user_daily_ding")) return MESSAGE_TYPE_DAILY;
        else if (StringUtil.notNullEqual(type, "group_post_ding")) return MESSAGE_TYPE_GROUP;
        else if (StringUtil.notNullEqual(type, "coser_tuijian")) return MESSAGE_TYPE_COS;
        else if (StringUtil.notNullEqual(type, "drawer_tuijian")) return MESSAGE_TYPE_ILL;
        else if (StringUtil.notNullEqual(type, "daily_tuijian")) return MESSAGE_TYPE_DAILY;
        else if (StringUtil.notNullEqual(type, "group_post_tuijian")) return MESSAGE_TYPE_GROUP;
        else if (StringUtil.notNullEqual(type, "group_tuijian")) return MESSATE_TYPE_GROUPTEAM;
        else if (StringUtil.notNullEqual(type, "ask_ding")) return MESSAGE_TYPE_ASK_SELF;
        else if (StringUtil.notNullEqual(type, "ask_tuijian")) return MESSAGE_TYPE_ASK_SELF;
        else if (StringUtil.notNullEqual(type, "ask_answerme")) return MESSAGE_TYPE_ASK;
        else if (StringUtil.notNullEqual(type, "ask_newask")) return MESSAGE_TYPE_ASKED;
        else if (StringUtil.notNullEqual(type, "ask_newaskanonymous")) return MESSAGE_TYPE_ASKED;
        else if (StringUtil.notNullEqual(type, "writer_replyme")) return MESSAGE_TYPE_WRITER;
        else if (StringUtil.notNullEqual(type, "writer_atme")) return MESSAGE_TYPE_WRITER;
        else if (StringUtil.notNullEqual(type, "writer_tuijian")) return MESSAGE_TYPE_WRITER;
        else if (StringUtil.notNullEqual(type, "writer_ding")) return MESSAGE_TYPE_WRITER;
        else if (StringUtil.notNullEqual(type, "coser_reply_ding")) return MESSAGE_TYPE_COS;
        else if (StringUtil.notNullEqual(type, "drawer_reply_ding")) return MESSAGE_TYPE_ILL;
        else if (StringUtil.notNullEqual(type, "writer_reply_ding")) return MESSAGE_TYPE_WRITER;
        else if (StringUtil.notNullEqual(type, "user_daily_reply_ding")) return MESSAGE_TYPE_DAILY;
        else if (StringUtil.notNullEqual(type, "group_post_reply_ding")) return MESSAGE_TYPE_GROUP;
        else if (StringUtil.notNullEqual(type, "novel_set_subscribe")) return MESSAGE_TYPE_WRITER;
        else if (StringUtil.notNullEqual(type, "novel_set_subs_update")) return MESSAGE_TYPE_WRITER;
        else if (StringUtil.notNullEqual(type, "coser_post_atme"))
            return MESSAGE_TYPE_COSER_CONTENT;
        else if (StringUtil.notNullEqual(type, "drawer_post_atme"))
            return MESSAGE_TYPE_DRAWER_CONTENT;
        else if (StringUtil.notNullEqual(type, "writer_post_atme"))
            return MESSAGE_TYPE_WRITER_CONTENT;
        else if (StringUtil.notNullEqual(type, "daily_post_atme"))
            return MESSAGE_TYPE_DAILY_CONTENT;
        else if (StringUtil.notNullEqual(type, "group_post_atme"))
            return MESSAGE_TYPE_GROUPPOST_CONTENT;
        else if (StringUtil.notNullEqual(type, "group_intro_atme"))
            return MESSAGE_TYPE_GROUPINTRO_CONTENT;
        else if (StringUtil.notNullEqual(type, "tag_group_add"))
            return MESSAGE_TYPE_TAGGROUPADD_CONTENT;
        else if (StringUtil.notNullEqual(type, "coser_post_lock")) return COSER_POST_LOCK;
        else if (StringUtil.notNullEqual(type, "coser_post_unlock")) return COSER_POST_UNLOCK;
        else if (StringUtil.notNullEqual(type, "drawer_post_lock")) return DRAWER_POST_LOCK;
        else if (StringUtil.notNullEqual(type, "drawer_post_unlock")) return DRAWER_POST_UNLOCK;
        else if (StringUtil.notNullEqual(type, "writer_post_lock")) return WRITER_POST_LOCK;
        else if (StringUtil.notNullEqual(type, "writer_post_unlock")) return WRITER_POST_UNLOCK;
        else if (StringUtil.notNullEqual(type, "daily_lock")) return DAILY_LOCK;
        else if (StringUtil.notNullEqual(type, "daily_unlock")) return DAILY_UNLOCK;
        else if (StringUtil.notNullEqual(type, "special")) return SPECIAL;
        else if (StringUtil.notNullEqual(type, "discover")) return DISCOVER;
        else if (StringUtil.notNullEqual(type, "send_gift")) return SEND_GIFT;
        else if (StringUtil.notNullEqual(type, "send_daily_gift")) return SEND_DAILY_GIFT;
        else if (StringUtil.notNullEqual(type, "top_list_coser")) return TOP_LIST_COSER;
        else if (StringUtil.notNullEqual(type, "top_list_drawer")) return TOP_LIST_DRAWER;
        else if (StringUtil.notNullEqual(type, "top_list_writer")) return TOP_LIST_WRITE;
        else if (StringUtil.notNullEqual(type, "group_invite")) return GROUP_INVITE;
        else if (StringUtil.notNullEqual(type, "circle_top_list")) return CIRCLE_TOP_LIST;
        else if (StringUtil.notNullEqual(type, "zhipin_goods_tuijian")) return ZHIPING_TUIJIAN;
        else if (StringUtil.notNullEqual(type, "zhipin_goods_ding")) return ZHIPING_DING;
        else if (StringUtil.notNullEqual(type, "sold_zhipin")) return ZHIPING_SOLD;
        else if (StringUtil.notNullEqual(type, "zhipin_goods_lock")) return ZHIPING_LOCK;
        else if (StringUtil.notNullEqual(type, "coser_commentatme")) return MESSAGE_TYPE_COS;
        else if (StringUtil.notNullEqual(type, "coser_commentme")) return MESSAGE_TYPE_COS;
        else if (StringUtil.notNullEqual(type, "drawer_commentme")) return MESSAGE_TYPE_ILL;
        else if (StringUtil.notNullEqual(type, "drawer_commentatme")) return MESSAGE_TYPE_ILL;
        else if (StringUtil.notNullEqual(type, "writer_commentme")) return MESSAGE_TYPE_WRITER;
        else if (StringUtil.notNullEqual(type, "writer_commentatme")) return MESSAGE_TYPE_WRITER;
        else if (StringUtil.notNullEqual(type, "daily_commentme")) return MESSAGE_TYPE_DAILY;
        else if (StringUtil.notNullEqual(type, "daily_commentatme")) return MESSAGE_TYPE_DAILY;
        else if (StringUtil.notNullEqual(type, "group_post_commentme")) return MESSAGE_TYPE_GROUP;
        else if (StringUtil.notNullEqual(type, "group_post_commentatme")) return MESSAGE_TYPE_GROUP;
        else if (StringUtil.notNullEqual(type, "coser_comment_ding")) return COSER_COMMENT_DING;
        else if (StringUtil.notNullEqual(type, "drawer_comment_ding")) return DRAWER_COMMENT_DING;
        else if (StringUtil.notNullEqual(type, "writer_comment_ding")) return WRITER_COMMENT_DING;
        else if (StringUtil.notNullEqual(type, "daily_comment_ding")) return DAILY_COMMENT_DING;
        else if (StringUtil.notNullEqual(type, "group_post_comment_ding"))
            return GROUP_POST_COMMENT_DING;
        else return MESSAGE_TYPE_OTHER;
    }

    public static int inWhichType(Message message) {
        return inWhichType(message.getType());
    }

    public static int whichType(String type) {
        if (StringUtil.notNullEqual(type, "coser_atme")) return MESSAGE_TYPE_REPLY;
        else if (StringUtil.notNullEqual(type, "coser_replyme")) return MESSAGE_TYPE_COMMENT;
        else if (StringUtil.notNullEqual(type, "drawer_atme")) return MESSAGE_TYPE_REPLY;
        else if (StringUtil.notNullEqual(type, "drawer_replyme")) return MESSAGE_TYPE_COMMENT;
        else if (StringUtil.notNullEqual(type, "group_atme")) return MESSAGE_TYPE_GROUP_REPLY;
        else if (StringUtil.notNullEqual(type, "group_topic_reply"))
            return MESSAGE_TYPE_GROUP_COMMENT;
        else if (StringUtil.notNullEqual(type, "writer_atme")) return MESSAGE_TYPE_REPLY;
        else if (StringUtil.notNullEqual(type, "writer_replyme")) return MESSAGE_TYPE_COMMENT;
        else if (StringUtil.notNullEqual(type, "writer_tuijian")) return MESSAGE_TYPE_TUIJIAN;
        else if (StringUtil.notNullEqual(type, "writer_ding")) return MESSAGE_TYPE_DING;
        else if (StringUtil.notNullEqual(type, "daily_replyme")) return MESSAGE_TYPE_DAILY_COMMENT;
        else if (StringUtil.notNullEqual(type, "daily_atme")) return MESSAGE_TYPE_DAILY_REPLY;
        else if (StringUtil.notNullEqual(type, "weibo_follow")) return MESSAGE_TYPE_FOLLOW;
        else if (StringUtil.notNullEqual(type, "drawer_ding")) return MESSAGE_TYPE_DING;
        else if (StringUtil.notNullEqual(type, "coser_ding")) return MESSAGE_TYPE_DING;
        else if (StringUtil.notNullEqual(type, "user_daily_ding")) return MESSAGE_TYPE_DAILY_DING;
        else if (StringUtil.notNullEqual(type, "group_post_ding")) return MESSAGE_TYPE_GROUP_DING;
        else if (StringUtil.notNullEqual(type, "coser_tuijian")) return MESSAGE_TYPE_TUIJIAN;
        else if (StringUtil.notNullEqual(type, "drawer_tuijian")) return MESSAGE_TYPE_TUIJIAN;
        else if (StringUtil.notNullEqual(type, "daily_tuijian")) return MESSAGE_TYPE_DAILY_TUIJIAN;
        else if (StringUtil.notNullEqual(type, "group_post_tuijian"))
            return MESSAGE_TYPE_GROUP_TUIJIAN;
        else if (StringUtil.notNullEqual(type, "group_tuijian"))
            return MESSATE_TYPE_GROUPTEAM_TUIJIAN;
        else if (StringUtil.notNullEqual(type, "ask_ding")) return MESSAGE_TYPE_ASK_DING;
        else if (StringUtil.notNullEqual(type, "ask_tuijian")) return MESSAGE_TYPE_ASK_TUIJIAN;
        else if (StringUtil.notNullEqual(type, "ask_answerme")) return MESSAGE_TYPE_ASK_ANSWER;
        else if (StringUtil.notNullEqual(type, "ask_newask")) return MESSAGE_TYPE_ASK_ASK;
        else if (StringUtil.notNullEqual(type, "ask_newaskanonymous"))
            return MESSAGE_TYPE_ASK_NONAMEASK;
        else if (StringUtil.notNullEqual(type, "coser_reply_ding")) return MESSAGE_TYPE_REPLY_DING;
        else if (StringUtil.notNullEqual(type, "drawer_reply_ding")) return MESSAGE_TYPE_REPLY_DING;
        else if (StringUtil.notNullEqual(type, "writer_reply_ding")) return MESSAGE_TYPE_REPLY_DING;
        else if (StringUtil.notNullEqual(type, "user_daily_reply_ding"))
            return MESSAGE_TYPE_REPLY_DING;
        else if (StringUtil.notNullEqual(type, "group_post_reply_ding"))
            return MESSAGE_TYPE_REPLY_DING;
        else if (StringUtil.notNullEqual(type, "novel_set_subscribe"))
            return MESSAGE_TYPE_NOVEL_SUBSCRIBE;
        else if (StringUtil.notNullEqual(type, "novel_set_subs_update"))
            return MESSAGE_TYPE_NOVEL_UPDATE;
        else if (StringUtil.notNullEqual(type, "coser_post_atme"))
            return MESSAGE_TYPE_COSER_CONTENT;
        else if (StringUtil.notNullEqual(type, "drawer_post_atme"))
            return MESSAGE_TYPE_DRAWER_CONTENT;
        else if (StringUtil.notNullEqual(type, "writer_post_atme"))
            return MESSAGE_TYPE_WRITER_CONTENT;
        else if (StringUtil.notNullEqual(type, "daily_post_atme"))
            return MESSAGE_TYPE_DAILY_CONTENT;
        else if (StringUtil.notNullEqual(type, "group_post_atme"))
            return MESSAGE_TYPE_GROUPPOST_CONTENT;
        else if (StringUtil.notNullEqual(type, "group_intro_atme"))
            return MESSAGE_TYPE_GROUPINTRO_CONTENT;
        else if (StringUtil.notNullEqual(type, "tag_group_add"))
            return MESSAGE_TYPE_TAGGROUPADD_CONTENT;
        else if (StringUtil.notNullEqual(type, "coser_post_lock")) return COSER_POST_LOCK;
        else if (StringUtil.notNullEqual(type, "coser_post_unlock")) return COSER_POST_UNLOCK;
        else if (StringUtil.notNullEqual(type, "drawer_post_lock")) return DRAWER_POST_LOCK;
        else if (StringUtil.notNullEqual(type, "drawer_post_unlock")) return DRAWER_POST_UNLOCK;
        else if (StringUtil.notNullEqual(type, "writer_post_lock")) return WRITER_POST_LOCK;
        else if (StringUtil.notNullEqual(type, "writer_post_unlock")) return WRITER_POST_UNLOCK;
        else if (StringUtil.notNullEqual(type, "daily_lock")) return DAILY_LOCK;
        else if (StringUtil.notNullEqual(type, "daily_unlock")) return DAILY_UNLOCK;
        else if (StringUtil.notNullEqual(type, "special")) return SPECIAL;
        else if (StringUtil.notNullEqual(type, "discover")) return DISCOVER;
        else if (StringUtil.notNullEqual(type, "send_gift")) return SEND_GIFT;
        else if (StringUtil.notNullEqual(type, "send_daily_gift")) return SEND_DAILY_GIFT;
        else if (StringUtil.notNullEqual(type, "top_list_coser")) return TOP_LIST_COSER;
        else if (StringUtil.notNullEqual(type, "top_list_drawer")) return TOP_LIST_DRAWER;
        else if (StringUtil.notNullEqual(type, "top_list_writer")) return TOP_LIST_WRITE;
        else if (StringUtil.notNullEqual(type, "group_invite")) return GROUP_INVITE;
        else if (StringUtil.notNullEqual(type, "circle_top_list")) return CIRCLE_TOP_LIST;
        else if (StringUtil.notNullEqual(type, "zhipin_goods_tuijian")) return ZHIPING_TUIJIAN;
        else if (StringUtil.notNullEqual(type, "zhipin_goods_ding")) return ZHIPING_DING;
        else if (StringUtil.notNullEqual(type, "sold_zhipin")) return ZHIPING_SOLD;
        else if (StringUtil.notNullEqual(type, "zhipin_goods_lock")) return ZHIPING_LOCK;
        else if (StringUtil.notNullEqual(type, "zhipin_goods_unlock")) return ZHIPING_UNLOCK;
        else if (StringUtil.notNullEqual(type, "coser_commentatme")) return COMMENT_REPLAY_AT_ME;
        else if (StringUtil.notNullEqual(type, "coser_commentme")) return COMMENT_REPLAY_ME;
        else if (StringUtil.notNullEqual(type, "drawer_commentme")) return COMMENT_REPLAY_ME;
        else if (StringUtil.notNullEqual(type, "drawer_commentatme")) return COMMENT_REPLAY_AT_ME;
        else if (StringUtil.notNullEqual(type, "writer_commentme")) return COMMENT_REPLAY_ME;
        else if (StringUtil.notNullEqual(type, "writer_commentatme")) return COMMENT_REPLAY_AT_ME;
        else if (StringUtil.notNullEqual(type, "daily_commentme")) return COMMENT_REPLAY_ME;
        else if (StringUtil.notNullEqual(type, "daily_commentatme")) return COMMENT_REPLAY_AT_ME;
        else if (StringUtil.notNullEqual(type, "group_post_commentme")) return COMMENT_REPLAY_ME;
        else if (StringUtil.notNullEqual(type, "group_post_commentatme"))
            return COMMENT_REPLAY_AT_ME;
        else if (StringUtil.notNullEqual(type, "coser_comment_ding")) return COSER_COMMENT_DING;
        else if (StringUtil.notNullEqual(type, "drawer_comment_ding")) return DRAWER_COMMENT_DING;
        else if (StringUtil.notNullEqual(type, "writer_comment_ding")) return WRITER_COMMENT_DING;
        else if (StringUtil.notNullEqual(type, "daily_comment_ding")) return DAILY_COMMENT_DING;
        else if (StringUtil.notNullEqual(type, "group_post_comment_ding"))
            return GROUP_POST_COMMENT_DING;
        else return MESSAGE_TYPE_OTHER;
    }

    public static int whichType(Message message) {
        return whichType(message.getType());
    }
}
